/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Servicio;

import Model.Detalle;
import Model.VentasXCongreso;
import Model.VentasXMes;

/**
 *
 * @author seba
 */
public class ManejadorReportes extends ManejadorAbstracto {


    public ManejadorReportes () {
    }

    protected String consulta(){
        String aux= "select * from";
        switch (opcion){
            case 0: aux=aux+ " Detalles_Cliente where ID="+valor;
                break;
            case 1: aux=aux+ " Detalles_Cliente order by Total desc";
                break;
            case 2: aux=aux+ " Detalles_Ventas order by anio,mes";
                break;
            case 3: aux=aux+ " Detalles_Congreso order by fecha desc";    
                
        }
        return aux;
    }
    
    protected Object nuevo(){
        Object auxObj=new Object();
        try {
           switch (opcion){
            case 0: auxObj= new Detalle (resultSet.getString("Min_Fech"),
                    resultSet.getInt("Cantidad"),resultSet.getInt("Total"));
                    break;
            case 1: auxObj= new Detalle (resultSet.getString("Min_Fech"),
                    resultSet.getInt("Cantidad"),resultSet.getInt("Total"));
                    String auxid = resultSet.getString("ID");
                    ((Detalle)auxObj).setCliente(Facade.obtenerCliente(auxid));
                    break;
            case 2: auxObj= new VentasXMes(resultSet.getInt("Mes"),resultSet.getInt("Anio"),
                    resultSet.getInt("Cantidad_Pedidos"),resultSet.getFloat("Total_Vendido"),
                    resultSet.getFloat("Total_Gasto"),resultSet.getInt("Cantidad_DVD"));
                    break;
            case 3: auxObj= new VentasXCongreso(
                    resultSet.getInt("Cantidad_Pedidos"),resultSet.getFloat("Total_Ventas"),
                    resultSet.getFloat("Total_Gasto"),resultSet.getFloat("Saldo_Final"),
                    resultSet.getInt("Cantidad_DVD"));
                    ((VentasXCongreso)auxObj).setCongreso(Facade.obtenerCongreso(resultSet.getString("Iniciales"), resultSet.getString("Fecha")));
                    
        }
           
       } catch (Exception e) {e.printStackTrace(); }

    return auxObj;
    }
    
    protected String table(){
        return "hola";
    }
    
    protected String values(Object objeto){
        return "hola";
    }
    
    protected String table_u(){
        return "hola";
    }
        
    protected String campos_u(Object objeto){
        return "hola";
    }
 
    protected String ides_u(Object objeto){
            return "hola";
    }
    
    protected String table_d(){
        return "null";
    }
        
    protected String campos_d(Object objeto){
        return "null";
    }
    
    
}